package com.furnitur.core.mapper.order;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.furnitur.core.entity.order.OrderItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface OrderItemMapper extends BaseMapper<OrderItem> {
    /**
     * 根据商家ID删除订单项
     */
    @Delete("DELETE FROM order_items WHERE furniture_id IN (SELECT id FROM furniture WHERE merchant_id = #{merchantId})")
    int deleteByMerchantId(@Param("merchantId") Long merchantId);
}